﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SQLite;
using System.IO;
using System.Data;

namespace Data
{
    public static class DataBaseHelper
    {
        public static SQLiteConnection GetConnection(string DataBaseName)
        {
            //Get the Path of the personal folder
            var documents = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            //var documents = "C:\\";
            
            //Create a Formated Path
            string db = Path.Combine(documents, DataBaseName);

            //Check if existe the DateBase
            bool exists = File.Exists(db);

            //If DB does not exist, create the DB file., 
            /*if (!exists)
                SQLiteConnection.CreateFile (db);*/

            //Create th ADO.NET connection Object
            var conn = new SQLiteConnection("Data Source=" + db);

            //If DB does not exist, create the Tables.
            return conn;
        }
    }
}
